using System;
using System.Globalization;
using System.IO;
using System.Windows.Data;

namespace SettingsView.Search
{
	public class Directory2ImageSource : IValueConverter
	{
		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			string text = value as string;
			if (Directory.Exists(text))
			{
				return ExtractIcon.GetIcon(text, false, true);
			}
			if (File.Exists(text))
			{
				return ExtractIcon.GetIcon(text, false, true);
			}
			return null;
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return null;
		}
	}
}
